package cn.wolfcode.p2p.controller;

import cn.wolfcode.p2p.base.domain.VideoAuth;
import cn.wolfcode.p2p.base.query.VideoAuthQueryObject;
import cn.wolfcode.p2p.base.service.IVideoAuthService;
import cn.wolfcode.p2p.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 后台视频认证审核
 */
@Controller
public class VideoAuthAuditController {

    @Autowired
    private IVideoAuthService videoAuthService;

    /**
     * 审核页面+查询
     *
     * @return
     */
    @RequestMapping("vedioAuth")
    public String videoAuth(Model model, @ModelAttribute("qo") VideoAuthQueryObject qo) {
        qo.setOrderBy("order_date asc");
        model.addAttribute("pageInfo", videoAuthService.queryForPages(qo));
        return "vedioAuth/list";
    }

    /**
     * 审核
     * @return
     */
    @RequestMapping("vedioAuth_audit")
    @ResponseBody
    public JsonResult vedioAuthAudit(Long id,int state,String remark) {
        videoAuthService.audit(id,state,remark);
        return JsonResult.instance();

    }
}
